package com.dhemery.mack.adapters;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.model.IWorkbenchAdapter;

import com.dhemery.mack.model.Node;

public class NodeInformationProvider implements IWorkbenchAdapter {
	private final NodeImageDescriptorFactory imageDescriptorFactory;

	public NodeInformationProvider(NodeImageDescriptorFactory imageDescriptorFactory) {
		this.imageDescriptorFactory = imageDescriptorFactory;
	}

	public Object[] getChildren(Object node) {
		return new Object[0];
	}

	public ImageDescriptor getImageDescriptor(Object node) {
		return imageDescriptorFactory.createImageDescriptor((Node)node);
	}

	public String getLabel(Object node) {
		return ((Node)node).getName();
	}

	public Object getParent(Object node) {
		return ((Node)node).getFolder();
	}
}
